// import type { App } from 'vue'
// import * as components from './components'
// import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// const install = function (app: App) {
//   Object.entries(components).forEach(([key, value]) => {
//     app.component(key, value)
//   })
//   for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
//     app.component(key, component)
//   }
// }

// export default install
// export * from './components'

//引入项目中全部的全局组件
// import SvgIcon from './SvgIcon/src/index.vue'
// import Pagination from './Pagination/src/index.vue'
import type { App } from 'vue'
import * as components from './components'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
//全局对象
// const allGlobalComponent: any = { SvgIcon, Pagination }

//对外暴露插件对象
export default {
  //务必叫做install方法
  install(app: App) {
    let appComponent = app.component
    // 注册项目的全部全局组件
    // Object.keys(allGlobalComponent).forEach((key) => {
    //   //注册为全局组件
    //   appComponent(key, allGlobalComponent[key])
    // })
    Object.entries(components).forEach(([key, value]) => {
      app.component(key, value)
    })
    // 将element-plus提供图标注册为全局组件
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component)
    }
  },
}
